clang-tidy modernize-use-auto, part 2, but (#485)
* clang-tidy modernize-use-auto, part 2, but
only on:
Message: use auto when initializing with a cast to avoid duplicating the type name
not on:
Message: use auto when initializing with new to avoid duplicating the type name
Message: use auto when initializing with a template cast to avoid duplicating the
Before running clang-tidy gbfile.h was changed to replace the macro definition of
gbfopen_le, gbfgetuint32, gbfgetuint16, gbfputuint16, gbfputuin32 with inline
function definitions. Without this change the application of modernize-use-auto
made it difficult to recognize the type of the result. Note this change has merit
of it's own,
see https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-macros
This was run with clang-tidy from llvm version 8. It generate serveral
compilation errors that will be fixed by hand in the next commit.
* fix errors introduced by clang-tidy modernize-use-auto.
These errors are of the form:
error: variable 'myvar' declared with deduced type 'auto *' cannot appear in its own initializer
They arose from patterns like:
mytype* myvar = (mytype*) xcalloc(1, sizeof(*myvar));
which clang-tidy changed to
auto* myvar = (mytype*) xcalloc(1, sizeof(*myvar));
These were edited by hand to the form
auto* myvar = (mytype*) xcalloc(1, sizeof(mytype));
At the same time, the order of the parameters in calls to
xcalloc was corrected.
47 files changed: